<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>获取排队号</title>
<link rel="stylesheet" href="css/input.css" />
<script type="text/javascript" src="js/jquery-3.2.1.js"></script>
<style type="text/css">
	body{
		font-size: 14px;
		background-color:#1f687a;
	}
	.tishi{
		width:150px;
		height:30px;
		float:left;
		margin:23px 0px 0px 0px;
		display: none;
		font-size:12px;
		color:white;
		
	}
	.update{
		width: 150px;
		height: 30px;
		font-size: 14px;
		font-weight:bold;
		border: 1px solid white;
		border-radius: 3px;
		margin: 0px 50px;
		background-color:#7ab893;
		color:white;
		cursor: pointer;
	}
	#number{
		color:white;
	}
</style>
</head>
<body>
	<div id='container'>
	 	<div class='message'>
	  		<label style="margin:20px 20px;">
				<input type='text' id="renshu" onkeyup="this.value=this.value.replace(/[^\d]/g,'') " onafterpaste="this.value=this.value.replace(/[^\d]/g,'')">
		      	<span>就餐人数</span>
		    </label>
		    <span class="tishi">请输入就餐人数</span>
		</div>
	</div>
	<input type="button" value="获取排队号" class="update"/>
	<h3 id="number"></h3>
</body>
<script type="text/javascript" src="js/jquery-3.2.1.js"></script>
<script type="text/javascript">
	$(function(){
		$(".update").click(function(){
			var renshu=$("#renshu").val();
			if(renshu.length==0){
				$(".tishi").show();
			}else if(renshu<1){
				$(".tishi").text("就餐人数不能小于1");
				$(".tishi").show();
			}else if(renshu>12){
				$(".tishi").text("就餐人数不能大于12");
				$(".tishi").show();
			}else{
				$.get("DuiLieServlet",{op:2,renshu:renshu},function(v){
					$("#number").text(v);
					parent.alert(v);
				});
			}
			
		})
	})
</script>
</html>